﻿@using X.PagedList;
@using X.PagedList.Mvc.Core;
@using X.PagedList.Mvc.Common;
@using FwProject.Restaurant.Dto
@model IPagedList<StockCheckDto>
@{
    Layout = null;
    var SumCount = 0;
    var SumCheckCount = 0;
    var SumProfitCount = 0;
    int i = 0;
    if (Model.Count > 0)
    {
        if (Model.PageNumber != 1)
        {

            i = (Model.PageNumber - 1) * Model.PageSize;
        }
    }
}
<div style="max-height:600px;overflow-y:scroll;">

    <table class="table table-bordered table-hover table-rowselected">
        <thead>
            <tr>
                <th style="width:45px">序号</th>
                <th>盘点单号</th>
                <th>餐厅名称</th>
                <th>经办人</th>
                <th>盘点日期</th>
                <th>应存数量</th>
                <th>盘点数量</th>
                <th>盈亏数量</th>
                <th>备注</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            @if (Model.Count == 0)
            {
                <tr><td colspan="10" align="center">暂无盘点信息</td></tr>
            }
            else
            {
                foreach (var item in Model)
                {
                    i++;
                    <tr>
                        <td>@i</td>
                        <td>@item.CreationNumber</td>
                        <td>@item.RestaurantInfoModel.RestaurantName</td>
                        <td>@item.Person</td>
                        <td>@item.CreationTime.ToString("yyyy-MM-dd HH:mm:ss")</td>
                        <td>@item.Count</td>
                        <td>@item.CheckCount</td>
                        <td>@item.ProfitCount</td>
                        <td>@item.RemarkContent</td>
                        <td><button type="button" class="btn btn-success btn-xs" data-toggle="modal" data-target="#modal_ajax" data-url="@Url.Action("Edit",new {id=item.Id })" data-backdrop="static"><i class="fa fa-edit"></i>编辑</button></td>
                    </tr>
                    SumCount += item.Count;
                    SumCheckCount += item.CheckCount;
                    SumProfitCount += item.ProfitCount;
                }
                <tr class="footer" style="color:red">
                    <td>合计</td>
                    <td colspan="4"></td>
                    <td>@SumCount</td>
                    <td>@SumCheckCount</td>
                    <td>@SumProfitCount</td>
                    <td colspan="2"></td>
                </tr>
            }
        </tbody>
    </table>
</div>
<div class="row pagedinfo">
    <div class="col-sm-5">
        @*共 @Model.TotalItemCount 条，@Model.PageSize 条/页 当前第 @Model.PageNumber/@Model.PageCount 页*@
        共 @Model.TotalItemCount 条，
        <select class="form-control" id="pageSize" style="width:70px;display:initial">
            @for (int z = 10; z < 100; z = z + 10)
            {
                if (z == Model.PageSize)
                {
                    <option selected value="@z">@z</option>
                }
                else
                {
                    <option value="@z">@z</option>
                }
            }
        </select> &nbsp;条/页 当前第 @Model.PageNumber/@Model.PageCount 页
    </div>
    <div class="col-sm-7">
        <input type="hidden" id="pageurl" value="&RestaurantName=@(Context.Request.Query["RestaurantName"])&Person=@(Context.Request.Query["Person"])&beginTime=@(Context.Request.Query["beginTime"])&endTime=@(Context.Request.Query["endTime"])&key=1" />
        @Html.PagedListPager(Model, page => Url.Action("Index", new { pageIdx = page, size = Context.Request.Query["size"], RestaurantName = Context.Request.Query["RestaurantName"], Person = Context.Request.Query["Person"], beginTime = Context.Request.Query["beginTime"], endTime = Context.Request.Query["endTime"] }), PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(new AjaxOptions() { AllowCache = false, HttpMethod = "Get", UpdateTargetId = "data_list", OnSuccess = "AjaxSuccessCallback", OnBegin = "AjaxBegin" }))
    </div>
</div>
